package spring.framework.beans;

import java.util.ArrayList;
import java.util.List;

/**
 * @author pengzh
 * @class PropertyValues
 * @since 2021-09-23
 */
public class PropertyValues {
    private List<PropertyValue> propertyValueList = new ArrayList<>();

    public PropertyValues addPropertyValue(PropertyValue propertyValue) {
        propertyValueList.add(propertyValue);
        return this;
    }

    public PropertyValue[] getPropertyValues() {
        return propertyValueList.toArray(new PropertyValue[0]);
    }

    public PropertyValue getPropertyValue(String propertyName) {
        for (PropertyValue property : propertyValueList) {
            if (property.getName().equals(propertyName)) {
                return property;
            }
        }
        return null;
    }

}
